package {
	import org.flixel.*;
	import flash.net.*;
 
	public class MenuState extends FlxState {
		[Embed(source = "../content/LEVIBRUSH.TTF", fontFamily = "Brush", embedAsCFF="false")] 	
			public var BrushFont:String;
		
		public function MenuState() {
			super();
		} 
		
		override public function create():void {
			FlxState.bgColor = 0xb4a912;
			add(new FlxSprite(0, 0, MenuImg)); 
			var title:FlxText;
			title = new FlxText(12, 12, FlxG.width - 20, 
				"I have done acid. Will you babysit me, please? I cannot get off the couch.");
			title.setFormat("Brush", 16, 0x000000, "center");
			add(title);
			
			var yesButton:FlxButton = new FlxButton(100, 60, onClickYes);
			var buttonBackground:FlxSprite = new FlxSprite();
			buttonBackground.createGraphic(50, 32, 0x00ffff00);
			yesButton.loadGraphic(buttonBackground);
			var yesTextBlack:FlxText = new FlxText(0, 0, 50, "-Yes");
			yesTextBlack.setFormat("Brush", 20, 0x2c3867, "center");
			var yesTextWhite:FlxText = new FlxText(0, 0, 50, "-Yes");
			yesTextWhite.setFormat("Brush", 20, 0xffffffff, "center");
			yesButton.loadText(yesTextBlack, yesTextWhite);
			add(yesButton);
			
			var noButton:FlxButton = new FlxButton(165, 60, onClickNo);
			noButton.loadGraphic(buttonBackground);
			var noTextBlack:FlxText = new FlxText(0, 0, 50, "-No");
			noTextBlack.setFormat("Brush", 20, 0x2c3867, "center");
			var noTextWhite:FlxText = new FlxText(0, 0, 50, "-No");
			noTextWhite.setFormat("Brush", 20, 0xffffffff, "center");
			noButton.loadText(noTextBlack, noTextWhite);
			add(noButton);
			
			FlxG.playMusic(Game.NormalMusic);
		}
		
		override public function update():void {
			if(FlxG.keys.justPressed("SPACE")) {
				FlxG.state = new PlayState();
			}
			super.update();
		}
		
		protected function onClickYes():void {
			FlxG.state = new PlayState();
		}
		
		protected function onClickNo():void {
			navigateToURL(new URLRequest("http://en.wikipedia.org/wiki/Milquetoast"));
		}
		
		[Embed(source = '../content/CouchMenu.png')] 
			private var MenuImg:Class;
	}
}